#!/bin/bash -v

# determine project name and version from debian changelog
read line < debian/changelog
PROJECT=${line%% *}
version_part=${line#* (}
VERSION=${version_part%%-*}
echo "Project '$PROJECT' version '$VERSION'"

# own build tree
DIR=/tmp/$PROJECT-$VERSION

# move subversion tree to tmp
svn export . $DIR --force

# build tar-ball
cd /tmp
tar -czf $PROJECT\_$VERSION.orig.tar.gz $PROJECT-$VERSION

# build debian package
cd $DIR
aclocal
autoconf
automake
dpkg-buildpackage -nc -rfakeroot
